package com.design.command.logger;

import java.io.IOException;

public class CommandLogDemo {
    public static void main(String[] args) throws IOException {
        TextEditor textEditor = new TextEditor();
        Command insertCommand = new InsertTextCommand(textEditor, "Hello, ");
        Command deleteCommand = new DeleteTextCommand(textEditor, "Hello, ");

        // 执行命令并记录日志
        insertCommand.execute();
        deleteCommand.execute();

        // 保存日志到文件
        textEditor.saveLogToFile("log.txt");
    }
}
